﻿using System;
using System.ApplicationModel;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ApplicationModel.Tests
{
    public class TestEntity : Entity
    {
        private string _stringLenghtProperty;
        private string _propertyChangingAwareProperty;
        private string _propertyChangedAwareProperty;
        private string _editableProperty;
        private int? _editableProperty2;
        private string _nonEditableWithInitialValueProperty;
        private int _nonEditableWithInitialValueProperty2;
        private string _property;
        private string _nonEditableProperty;

        [StringLength(5)]
        public string StringLenghtProperty 
        {
            get { return _stringLenghtProperty; }
            set { _stringLenghtProperty = value; }
        }

        public string PropertyChangingAwareProperty
        {
            get { return _propertyChangingAwareProperty; }
            set
            {
                RaisePropertyChanging();
                _propertyChangingAwareProperty = value;
            }
        }

        public string PropertyChangedAwareProperty
        {
            get { return _propertyChangedAwareProperty; }
            set
            {
                _propertyChangedAwareProperty = value;
                RaisePropertyChanged();
            }
        }

        [Editable(true)]
        public string EditableProperty
        {
            get { return _editableProperty; }
            set
            {
                if (_editableProperty != value)
                {
                    RaisePropertyChanging();
                    _editableProperty = value;
                    RaisePropertyChanged();
                }
            }
        }

        [Editable(true)]
        public int? EditableProperty2
        {
            get { return _editableProperty2; }
            set
            {
                if (_editableProperty2 != value)
                {
                    RaisePropertyChanging();
                    _editableProperty2 = value;
                    RaisePropertyChanged();
                }
            }
        }

        [Editable(false, AllowInitialValue=true)]
        public string NonEditableWithInitialValueProperty
        {
            get { return _nonEditableWithInitialValueProperty; }
            set
            {
                if (_nonEditableWithInitialValueProperty != value)
                {
                    RaisePropertyChanging();
                    _nonEditableWithInitialValueProperty = value;
                    RaisePropertyChanged();
                }
            }
        }

        [Editable(false, AllowInitialValue = true)]
        public int NonEditableWithInitialValueProperty2
        {
            get { return _nonEditableWithInitialValueProperty2; }
            set
            {
                if (_nonEditableWithInitialValueProperty2 != value)
                {
                    RaisePropertyChanging();
                    _nonEditableWithInitialValueProperty2 = value;
                    RaisePropertyChanged();
                }
            }
        }

        [Editable(false)]
        public string NonEditableProperty
        {
            get { return _nonEditableProperty; }
            set
            {
                if (_nonEditableProperty != value)
                {
                    RaisePropertyChanging();
                    _nonEditableProperty = value;
                    RaisePropertyChanged();
                }
            }
        }
    }
}
